workspace 'MDCCatalog.xcworkspace'
project 'MDCCatalog.xcodeproj'

# TODO: Uncomment line below and switch from legacy build system when Cocoapods 1.6 goes out of beta
# install! 'cocoapods', :disable_input_output_paths => true

target "MDCCatalog" do
  platform :ios, '11.0'
  project 'MDCCatalog.xcodeproj'
  pod 'MaterialComponentsExamples', :path => '../'
  pod 'MaterialComponents', :path => '../', :testspecs => [
    'ActionSheet/UnitTests',
    'ActivityIndicator/UnitTests',
    'AnimationTiming/UnitTests',
    'AppBar/UnitTests',
    'Banner/UnitTests',
    'BottomAppBar/UnitTests',
    'BottomNavigation/UnitTests',
    'BottomNavigation+BottomNavigationController/UnitTests',
    'BottomNavigation+Theming/UnitTests',
    'BottomSheet/UnitTests',
    'ButtonBar/UnitTests',
    'Buttons/UnitTests',
    'Cards/UnitTests',
    'Chips/UnitTests',
    'CollectionCells/UnitTests',
    'CollectionLayoutAttributes/UnitTests',
    'Collections/UnitTests',
    'Dialogs/UnitTests',
    'Elevation/UnitTests',
    'FeatureHighlight/UnitTests',
    'FlexibleHeader/UnitTests',
    'HeaderStackView/UnitTests',
    'Ink/UnitTests',
    'LibraryInfo/UnitTests',
    'List/UnitTests',
    'NavigationBar/UnitTests',
    'NavigationDrawer/UnitTests',
    'OverlayWindow/UnitTests',
    'PageControl/UnitTests',
    'Palettes/UnitTests',
    'private/Application/UnitTests',
    'private/Color/UnitTests',
    'private/Icons/UnitTests',
    'private/KeyboardWatcher/UnitTests',
    'private/Math/UnitTests',
    'private/Overlay/UnitTests',
    'private/TextControlsPrivate+TextFields/UnitTests',
    'private/ThumbTrack/UnitTests',
    'private/UIMetrics/UnitTests',
    'ProgressView/UnitTests',
    'ProgressView+Theming/UnitTests',
    'Ripple/UnitTests',
    'schemes/Color/UnitTests',
    'schemes/Container/UnitTests',
    'schemes/Shape/UnitTests',
    'schemes/Typography/UnitTests',
    'ShadowElevations/UnitTests',
    'ShadowLayer/UnitTests',
    'ShapeLibrary/UnitTests',
    'Shapes/UnitTests',
    'Slider/UnitTests',
    'Snackbar/UnitTests',
    'Tabs/UnitTests',
    'Tabs+Theming/UnitTests',
    'Tabs+TabBarView/UnitTests',
    'TextFields/UnitTests',
    'TextControls+BaseTextAreas/UnitTests',
    'TextControls+BaseTextFields/UnitTests',
    'TextControls+FilledTextAreas/UnitTests',
    'TextControls+FilledTextAreasTheming/UnitTests',
    'TextControls+FilledTextFields/UnitTests',
    'TextControls+FilledTextFieldsTheming/UnitTests',
    'TextControls+OutlinedTextAreas/UnitTests',
    'TextControls+OutlinedTextAreasTheming/UnitTests',
    'TextControls+OutlinedTextFields/UnitTests',
    'TextControls+OutlinedTextFieldsTheming/UnitTests',
    'Themes/UnitTests',
    'Typography/UnitTests',
  ]
  pod 'MaterialComponentsSnapshotTests', :path => '../', :testspecs => [
    'SnapshotTests'
  ]
  pod 'CatalogByConvention', "~> 2.5"
  pod 'MaterialCatalog', :path => 'MaterialCatalog/'

  use_frameworks!
end

target "MDCActionExtension" do
  platform :ios, '11.0'
  project 'MDCCatalog.xcodeproj'
  pod 'MaterialComponentsExamples', :path => '../'
  pod 'MaterialComponents', :path => '../'
  pod 'CatalogByConvention', "~> 2.5"
  pod 'MaterialCatalog', :path => 'MaterialCatalog/'

  use_frameworks!
end

target "MDCDragons" do
  platform :ios, '11.0'
  project 'MDCDragons.xcodeproj'
  pod 'CatalogByConvention', "~> 2.5"
  pod 'MaterialComponents', :path => '../'
  pod 'MaterialComponentsExamples', :path => '../'
  use_frameworks!
end

post_install do |installer|

  mdc_xcconfigs = []
  target_support_files_path = File.dirname(installer.pods_project.path) + "/" + "Target Support Files"
  subdirectories = ["MaterialComponents", "MaterialComponentsExamples", "Pods-MDCCatalog"]
  subdirectories.each do |subdirectory|
  subdirectory_path = target_support_files_path + "/" + subdirectory
    Dir.foreach(subdirectory_path) do |file|
      if file.include? "xcconfig"
        file_path = subdirectory_path + "/" + file
        mdc_xcconfigs.push file_path
      end
    end
  end

  # Note the path is relative to the xcconfig file being modified.
  # https://pewpewthespells.com/blog/xcconfig_guide.html
  mdc_xcconfigs.each do |mdc_xcconfig|
    new_xcconfig = File.read(mdc_xcconfig)
    new_xcconfig << "\n#include \"../../../MaterialComponentsWarnings.xcconfig\""
    File.write(mdc_xcconfig, new_xcconfig)
  end
end
